package com.sinodata.bsm.common.utils;

import java.util.*;
import java.io.*;

public class PropertiesUtil {
    public static Properties getProperties(String filename) throws IOException, FileNotFoundException {
        if (filename == null || filename.trim().length() == 0) {
            throw new FileNotFoundException("Files Name can't be null or String of length 0.");
        }
        FileInputStream configStream = null;
        Properties prop = new Properties();
        try {
            configStream = new FileInputStream(filename);
            prop.load(configStream);
        } finally {
            if (null != configStream) {
                try {
                    configStream.close();
                } catch (Throwable t) {
                    t.getMessage();
                }
            }
        }/*
         		 * ClassLoader classLoader =
         		 * Thread.currentThread().getContextClassLoader(); prop.load(
         		 * classLoader.getResourceAsStream(filename) );
         		 */
        return prop;
    }
}
